package com.vcredit.creditcat.vo;

import java.io.Serializable;

public class CommonResultExt<T> implements Serializable {

  private static final long serialVersionUID = 1L;
  private String status;
  private String msg;
  private T data;

  public CommonResultExt(String status, String msg, T data) {
    super();
    this.status = status;
    this.data = data;
    this.msg = msg;
  }

  public CommonResultExt(T data) {
    super();
    this.status = "000";
    this.data = data;
    this.msg = "请求数据成功";
  }

  public CommonResultExt() {}

  public String getStatus() {
    return status;
  }

  public void setStatus(String status) {
    this.status = status;
  }

  public String getMsg() {
    return msg;
  }

  public void setMsg(String msg) {
    this.msg = msg;
  }

  public T getData() {
    return data;
  }

  public void setData(T data) {
    this.data = data;
  }

  public static <T> JsonResult<T> SuccessResponse(T data) {
    return new JsonResult<T>("000", "请求数据成功", data);
  }

  public static <T> JsonResult<T> ErrorResponse(String errorMessage) {
    return new JsonResult<T>("001", errorMessage, null);
  }

  public static <T> JsonResult<T> ErrorResponse(String status, String errorMessage) {
    return new JsonResult<T>(status, errorMessage, null);
  }
}
